<?php
namespace app\models\request;

use app\components\Code1Validator;
use yii\base\Model;

class ReqSendCode extends Model
{

    private $phone;


    private $sessionId;
    private $code;
    private $type="register";

    /**
     * @return mixed
     */
    public function getType()
    {
        return $this->type;
    }

    /**
     * @param mixed $type
     */
    public function setType($type)
    {
        $this->type = $type;
    }



    /**
     * @return mixed
     */
    public function getCode()
    {
        return $this->code;
    }

    /**
     * @param mixed $code
     */
    public function setCode($code)
    {
        $this->code = $code;
    }





    /**
     * @return mixed
     */
    public function getSessionId()
    {
        return $this->sessionId;
    }

    /**
     * @param mixed $sessionId
     */
    public function setSessionId($sessionId)
    {
        $this->sessionId = $sessionId;
    }




    /**
     * @return mixed
     */
    public function getPhone()
    {
        return $this->phone;
    }

    /**
     * @param mixed $phone
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;
    }


    public function getSendKey(){
        return \Yii::$app->params["CODE_FIX"].$this->getType().$this->getPhone();
    }



    public function rules()
    {
        return [
            [[ 'phone','code','type'], 'required'],
            ['sessionId', 'required','message' => 'sessionId not bank'],
            ['code', Code1Validator::class],
        ];
    }


}